//////////////////////////////////////////////////////////////////////////////////
// Who  : Lim, Dong-moon (dmlim@nate.com, 011-701-9381)
// When : 2009/04/14
//////////////////////////////////////////////////////////////////////////////////

#ifndef __NBLOB_H__
#define __NBLOB_H__

#ifdef WIN32
#include <windows.h>
#else
#include <ncrypt_types.h>
#endif


#define		NCRYPT_BLOB_INVALID	-1
#define		NCRYPT_BLOB_RAW		0
#define		NCRYPT_BLOB_BASE16	1
#define		NCRYPT_BLOB_BASE64	2
#define		NULL_BLOB NCRYPT_NULL_BLOB

typedef struct _NBLOB
{
	DWORD cSize;
	BYTE* pData;
} NBLOB;

typedef NBLOB* PNBLOB;

void DestroyBlob(NBLOB* pBlob);

BOOL operator==(NBLOB a, NBLOB b);
BOOL operator!=(NBLOB a, NBLOB b);
NBLOB* DupBlob(const NBLOB* pSrcBlob);
DWORD CopyBlob(NBLOB* pDstBlob, const NBLOB* pSrcBlob);
void AssignBlob(NBLOB* pBlob, BYTE* pData, DWORD cSize);
void AllocBlob(NBLOB* pBlob, DWORD cSize);
void FreeBlob(NBLOB* pBlob);
void DestroyBlob(NBLOB* pBlob);
NBLOB* MergeBlob(int n, ...);
NBLOB* SplitBlob(NBLOB* pMerged, int *pLen = 0);
int CompareBlob(NBLOB* pBlob1, NBLOB* pBlob2);
int GetBlobArrayLen(NBLOB* pBlob);

#endif //__NBLOB_H__

extern const NBLOB NCRYPT_NULL_BLOB;
